package com.briup.oagg.model.web.controller;

import com.briup.framework.utils.web.Response;
import com.briup.oagg.model.bean.ext.OperatorComponentExt;
import com.briup.oagg.model.service.IOperatorComponentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 算法层组件前端控制器
 *
 * @author briup
 */
@Api(tags = "4.算法层组件管理")
@RestController
@RequestMapping("/operatorComponent")
public class OperatorComponentController {
    @Autowired
    private IOperatorComponentService service;

    @ApiOperation(value = "根据算子平台和类型查询学习算子组件")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "platform",value = "算子平台(ml 机器学习，dl 深度学习)",allowableValues = "ml,dl",required = true,dataTypeClass = String.class),
            @ApiImplicitParam(name = "type",value = "算子类型(0分类 1聚类 2回归)",allowableValues = "0,1,2",dataTypeClass = Integer.class)
    })
    @GetMapping
    public Response<List<OperatorComponentExt>> findByCondition(@RequestParam String platform, Integer type){
        List<OperatorComponentExt> list = service.findByCondition(platform,type);
        return Response.success(list);
    }
}
